package chatter;

import javax.swing.JFrame;

public class ChatFrame extends JFrame implements Observer {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ChatPanel panel;

	public ChatFrame(Chatter[] chatters) {
		panel = new ChatPanel(chatters);
		panel.setObserver(this);
		add(panel);
		pack();
		setResizable(false);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setVisible(true);
	}

	public static void main(String[] args) {
		Chatter[] chatters = new Chatter[3];
		chatters[0] = new RealChatter("Vasya");
		chatters[1] = new RealChatter("Petya");
		chatters[2] = new RealChatter("Ghora");

		new ChatFrame(chatters);

	}
	@Override
	public void notifyEvent(Event e) {
		this.setTitle(e.what());
		
	}

}
